* Replication file for Timothy J. Ryan, "Reconsidering Moral Issues in Politics," JOP 2014.
* Questions, contact TJRyan@umich.edu

* This file produces Figure 1.

* Combine student and MT datasets
cd "/Users/TJRyan/Dropbox/morality/YM/6_replication"
use "studentrep.dta", clear
append using "mtrep.dta"

* Identify student vs. MT datasets based on survey date
gen um = 0
replace um = 1 if regexm(v8, "2012-11")
gen mt = 1-um


set scheme sj
preserve
collapse (p10) p10=cbsmor (p25) p25=cbsmor (p75) p75=cbsmor (p90) p90=cbsmor (mean) mean=cbsmor (median) med=cbsmor, by(mt) 
twoway rcap p75 p25 mt, ///
	lwidth(medthick) lcolor(black) ysc(r(0(.2)1)) ylab(0(.2)1, nogrid) ///
	|| scatter mean mt, /// 
	xscale(r(-.6 1.6)) xtitle("") msymbol(square) ytitle("Moral Conviction") xtitle("Collective Bargaining") ///
	mcolor(black) msize(large) legen(off) xlab(0 "Students" 1 "MTurk") ///
	yline(0 .2 .4 .6 .8 1, lstyle(grid)) ///
	|| scatter p10 mt, msymbol(+) mcolor(black) msize(large) ///
	|| scatter p90 mt, msymbol(+) mcolor(black) msize(large) 
graph save "cbboxsimp", replace
restore

preserve
collapse (p10) p10=sssmor (p25) p25=sssmor (p75) p75=sssmor (p90) p90=sssmor (mean) mean=sssmor (median) med=sssmor, by(mt) 
twoway rcap p75 p25 mt, ///
	lwidth(medthick) lcolor(black) ysc(r(0(.2)1)) ylab(0(.2)1, nogrid) ///
	|| scatter mean mt, /// 
	xscale(r(-.6 1.6)) xtitle("") msymbol(square) ytitle("") xtitle("Social Security") ///
	mcolor(black) msize(large) legen(off) xlab(0 "Students" 1 "MTurk") ylab("") ///
	yline(0 .2 .4 .6 .8 1, lstyle(grid)) ///
	|| scatter p10 mt, msymbol(+) mcolor(black) msize(large)  ///
	|| scatter p90 mt, msymbol(+) mcolor(black) msize(large) 
graph save "ssboxsimp", replace
restore

preserve
collapse (p10) p10=scsmor (p25) p25=scsmor (p75) p75=scsmor (p90) p90=scsmor (mean) mean=scsmor (median) med=scsmor, by(mt) 
twoway rcap p75 p25 mt, ///
	lwidth(medthick) lcolor(black) ysc(r(0(.2)1)) ylab(0(.2)1, nogrid) ///
	|| scatter mean mt, /// 
	xscale(r(-.6 1.6)) xtitle("") msymbol(square) ytitle("") xtitle("Stem Cell") ///
	mcolor(black) msize(large) legen(off) xlab(0 "Students" 1 "MTurk") ylab("") ///
	yline(0 .2 .4 .6 .8 1, lstyle(grid)) ///
	|| scatter p10 mt, msymbol(+) mcolor(black) msize(large) ///
	|| scatter p90 mt, msymbol(+) mcolor(black) msize(large)
graph save "scboxsimp", replace
restore

preserve
collapse (p10) p10=gmsmor (p25) p25=gmsmor (p75) p75=gmsmor (p90) p90=gmsmor (mean) mean=gmsmor (median) med=gmsmor, by(mt) 
twoway rcap p75 p25 mt, ///
	lwidth(medthick) lcolor(black) ysc(r(0(.2)1)) ylab(0(.2)1, nogrid) ///
	|| scatter mean mt, /// 
	xscale(r(-.6 1.6)) xtitle("") msymbol(square) ytitle("") xtitle("Gay Marriage") ///
	mcolor(black) msize(large) legen(off) xlab(0 "Students" 1 "MTurk") ylab("") ///
	yline(0 .2 .4 .6 .8 1, lstyle(grid)) ///
	|| scatter p10 mt, msymbol(+) mcolor(black) msize(large) ///
	|| scatter p90 mt, msymbol(+) mcolor(black) msize(large)
graph save "gmboxsimp", replace
restore


preserve
collapse (p10) p10=afsmor (p25) p25=afsmor (p75) p75=afsmor (p90) p90=afsmor (mean) mean=afsmor (median) med=afsmor, by(mt) 
twoway rcap p75 p25 mt, ///
	lwidth(medthick) lcolor(black) ysc(r(0(.2)1)) ylab(0(.2)1, nogrid) ///
	|| scatter mean mt, /// 
	xscale(r(-.6 1.6)) xtitle("") msymbol(square) ytitle("") xtitle("Afghanistan") ///
	mcolor(black) msize(large) legen(off) xlab(0 "Students" 1 "MTurk") ylab("") ///
	yline(0 .2 .4 .6 .8 1, lstyle(grid)) ///
	|| scatter p10 mt, msymbol(+) mcolor(black) msize(large) ///
	|| scatter p90 mt, msymbol(+) mcolor(black) msize(large)
graph save "afboxsimp", replace
restore

graph combine cbboxsimp.gph ssboxsimp.gph scboxsimp.gph gmboxsimp.gph afboxsimp.gph, rows(1) ysize(2) xsize(6.5)
